home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / cli / gulam.arc / examples.arc / MULTIVOL.G < prev    next >
Text File  |  1989-01-09  |  4KB  |  181 lines

  1. #
  2. # MULTIVOL
  3. #
  4. # syntax:
  5. #    multivol volname sequence_number
  6. #
  7. # What it does:
  8. # For each of several floppies,
  9. #    select a Volume Id. containing the index number,
  10. #    FORMAT the floppy,
  11. #    create a file whose name is the index number,
  12. #    write the Volume Id.
  13.  
  14. # A prompt for
  15. set prpt1 ' Please press the RETURN key. '
  16. set ginprompt ' Begin processing floppy diskettes.'
  17. # echo "Begin processing floppy diskettes.  Enter any positive integer to quit."
  18.  
  19. # Collect the arguments ------------------------------------------------------
  20.     set arg1 $1
  21.     set arg2 $2
  22.     set arg3 $3
  23.     set arg4 $4
  24.  
  25. # Check arguments ------------------------------------------------------------
  26. set argc 0
  27. foreach xx { $- }
  28.     set argc $argc + 1
  29. endfor
  30. unset xx
  31.  
  32. if { $argc < 2 }
  33.         echo 'The syntax for the MULTIVOL command is:'
  34.         echo '    '
  35.         echo '    ' multivol volname sequence_number
  36.         echo '    '
  37.         echo 'Need at least two arguments.'
  38.         echo
  39.         unset argc
  40.         unset prpt1
  41.         unset ginprompt
  42.         unset arg1
  43.         unset arg2
  44.         unset arg3
  45.         unset arg4
  46.         exit
  47. endif
  48.  
  49. if { $arg2 == 0 }
  50.     echo 'Do you really want to start with index number of zero?'
  51.     set magic 7890
  52.     set ginprompt " If yes, enter $magic, the magic number: "
  53.     set xx $<
  54.     set ginprompt " $prpt1 "
  55.     if { $xx == $magic }
  56.         unset xx
  57.         unset magic
  58.         # nothing
  59.     ef
  60.         echo Quit.
  61.         unset xx
  62.         unset magic
  63.         unset ginprompt
  64.         unset arg1
  65.         unset arg2
  66.         unset arg3
  67.         unset arg4
  68.         unset argc
  69.         unset prpt1
  70.         exit
  71.     endif
  72. endif
  73.  
  74. # Set parameters for the loop ------------------------------------------------
  75. set    V_name $arg1    # Name to use for volume id
  76. set    Starter    $arg2    # The first sequence number to use
  77.  
  78. if { $argc < 3 }    # How many diskettes to do.
  79.     set hi_lim 10        
  80. ef
  81.     set hi_lim $arg3
  82. endif
  83.  
  84. if { 0 == $hi_lim }
  85.     echo 'Ok, just did 0 diskettes.  Quit'
  86.     unset arg3
  87.     unset arg2
  88.     unset arg1
  89.     unset V_name
  90.     unset Starter
  91.     unset ginprompt
  92.     unset arg1
  93.     unset arg2
  94.     unset arg3
  95.     unset arg4
  96.     unset argc
  97.     unset prpt1
  98.     exit
  99. endif
  100.     
  101. # echo "Begin processing floppy diskettes.  Enter any positive integer to quit."
  102. set count 0
  103. # The main loop ----------------------------------------------------------
  104. while { $count < $hi_lim }
  105.  
  106.     # echo ' '
  107.     
  108.     if { 0 == $count }
  109.     ef
  110.         echo 'Remove disk number' $Index_Num.
  111.     endif
  112.     
  113.     set    Index_Num    $Starter + $count
  114.     set    Vol_Id        $V_name.$Index_Num
  115.     set    to_go        $hi_lim - $count
  116.     set    msg        "$count done, $to_go to go."
  117.     
  118.     echo 'Insert disk number' $Index_Num. '  (' $msg ')'
  119.     
  120.     # read the keybd.
  121.     set ginprompt '(Enter any non-zero number to abort.)'
  122.     set xx $<
  123.     set c1 $count + 1
  124.     if { $c1 == $hi_lim }
  125.         set ginprompt " Done.  Press return. "
  126.     ef
  127.         set ginprompt " $prpt1 "
  128.     endif
  129.     if { 0 == $xx } then
  130.         unset xx
  131.         
  132.         # format the disk
  133.         echo '1    format -2 a:'    # No. of sides, which drive.
  134.         #    format -2 a:
  135.         
  136.         # Make a file with the number as its name.
  137.         echo '2    echo    ' "    $Vol_Id > a:\$Index_Num "
  138.         #    echo        $Vol_Id > a:\$Index_Num
  139.         
  140.         # Make the "disktop" file.
  141.         echo '3    echo    ' "    $Vol_Id > a:\disktop.inf"
  142.         #    echo        $Vol_Id > a:\disktop.inf
  143.         
  144.         # Write the Volume Id.
  145.         echo '4    vol a' "    $Vol_Id"
  146.         #    vol a        $Vol_Id
  147.         
  148.         # Tell user something
  149.         echo '5    vol a'
  150.             vol a    
  151.         
  152.         # echo ' '
  153.     ef
  154.         unset xx
  155.         set count 1 + $hi_lim      # make it too big, to quit
  156.         set ginprompt '   DONE.  press return. '
  157.     endif
  158.     set count 1 + $count
  159. endwhile
  160.  
  161. # echo "Done"
  162.  
  163. unset ginprompt
  164. unset V_name
  165. unset Index_Num
  166. unset hi_lim
  167. unset Vol_Id
  168. unset Starter
  169. unset to_go
  170. unset msg
  171. unset argc
  172. unset arg1
  173. unset arg2
  174. unset arg3
  175. unset arg4
  176. unset argc
  177. unset prpt1
  178. unset count
  179. unset c1
  180. exit
  181.